#ifndef HHPRFAPI
#define HHPRFAPI

#include <windows.h>
#include <IPTYPES.H>


#define HHPRFAPI_MAXSSIDLEN			31
#define HHPRFAPI_MACADDRLEN			6
#define MAX_ADAPTERS				16
#define	SWC_OFFLINE_ADAPTER_NAME	TEXT("DSFLTR_*")
#define	CONFIG_CTRL_IFACE_MSGQUEUE

#define WPA_CTRL_REQ				"CTRL-REQ-"
#define WPA_CTRL_RSP				"CTRL-RSP-"

typedef enum {
	RFSTATE_NOT_AVAILABLE   = 0,			// returned when radio disabled
	RFSTATE_DISCONNECTED    = 5,			
	RFSTATE_SCANNING        = 4,
	RFSTATE_ASSOCIATING		= 10,
	RFSTATE_CONNECTED       = 1,
	RFSTATE_4WAY_HANDSHAKE	= 11,
	RFSTATE_GROUP_HANDSHAKE = 12,
	RFSTATE_AUTHENTICATED   = 2,

	RFSTATE_SYNCED          = 3,			// unused
	RFSTATE_INT_TEST_FAIL   = 6,			// unused
	RFSTATE_SEC_FAIL        = 7,			// unused
	RFSTATE_DISABLED        = 8,			// unused

} HHPRFAPI_RFSTATUS;

typedef enum {
	RFPOWERMODE_CAM			= 1,
	RFPOWERMODE_MAXPSP		= 2,
	RFPOWERMODE_FASTPSP		= 3
} HHPRFAPI_POWERMODE;

// infrastructure mode
typedef enum  {
    RFBSSMODE_IBSS				= 0,
    RFBSSMODE_INFRASTRUCTURE	= 1,
    RFBSSMODE_AUTOUNKNOWN		= 2
} HHPRFAPI_BSSMODE;

#ifdef __cplusplus
extern "C" {
#endif

DWORD	HHPOpenRFAdapter(HANDLE *phAdapter = NULL);
BOOL	HHPCloseRFAdapter();
WCHAR *	HHPGetRFAdapterName();
BOOL	HHPGetRFAdapterEnableState(BOOL *pbEnabled);
BOOL	HHPSetRFAdapterEnableState(BOOL bEnabled);
BOOL	HHPSetRFAdapterEnableStateEx(BOOL bEnabled, BOOL bReg);
BOOL	HHPGetRFAdapterStatus(HHPRFAPI_RFSTATUS *pdwStatus);
BOOL	HHPGetRFAdapterLinkStatus(DWORD	*pdwLinkQualityPct, DWORD *pdwSignalStrengthPct, BOOL *pbAssociated);	// deprecated
BOOL	HHPGetRFAdapterLinkStatusEx(DWORD *pdwLinkQualityPct, INT *piSignalStrengthdBm, BOOL *pbAssociated);	// deprecated				
BOOL	HHPGetRFAdapterLinkQuality(INT *piSignalStrengthdBm, INT *piNoisedBm, INT *piSNRdB);
INT		HHPDbmToPercent(INT lVal);
INT		HHPSNRToPercent(INT iSNR);
INT		HHPNoiseToPercent(INT iNoise);
BOOL	HHPGetRFAdapterSSID(UCHAR *pszSsid, DWORD dwSsidLen);
BOOL	HHPGetRFAdapterPowerMode(HHPRFAPI_POWERMODE *pdwPowerMode);
BOOL	HHPGetRFAdapterBSSID(BYTE *pbyBSSID, DWORD *pdwLen);
BOOL	HHPGetRFAdapterMACAddress(BYTE *pbyMACAddress, DWORD *pdwLen);
BOOL	HHPGetRFAdapterBSSMode(HHPRFAPI_BSSMODE *pBSSMode);
BOOL	HHPGetRFAdapterChannel(DWORD *pdwChannel);
BOOL	HHPGetRFAdapterChannelEx(DWORD *pdwChannel, FLOAT *pfBand);
BOOL	HHPGetRFAdapterTxRate(DWORD *pdwTxRate);
BOOL	HHPRFAdapterBSSIDListScan();
BOOL	HHPRFAdapterBSSIDListIter(
			DWORD				dwIndex, 
			BYTE				*pbyMACAddr,
			DWORD				dwMACAddrLen,
			UCHAR				*pszSsid, 
			DWORD				dwSsidLen,
			DWORD				*pdwWEP,
			DWORD				*pdwSignalStrengthPct,
			HHPRFAPI_BSSMODE	*pBSSMode);
			
IP_ADAPTER_INFO *	HHPGetRFAdapterIPInfo();

HANDLE	HHPSWCOpen(const WCHAR *pwszAdapterName);
BOOL	HHPSWCClose(HANDLE hCtrl);
BOOL	HHPSWCRequest(HANDLE hCtrl, 
			const CHAR *	pszCmd, 
			DWORD			dwCmdLen,
			CHAR *			pszReply, 
			DWORD *			pdwReplyLen,
			void *			pReserved);
BOOL	HHPSWCRecv(HANDLE hCtrl, 
			char *			pszReply, 
			DWORD *			pdwReplyLen);
BOOL	HHPSWCPending(HANDLE hCtrl);			
BOOL	HHPSWCAttach(HANDLE hCtrl);
BOOL	HHPSWCDetach(HANDLE hCtrl);

#ifdef __cplusplus
}
#endif

#endif HHPRFAPI
